import React from 'react';
import {Form,Button,Input} from 'antd';
import { WeaInput,WeaCheckbox,WeaSelect } from 'ecCom';
const FormItem = Form.Item;
import FormGroup from './base/FormGroup';
import FormItem4Title from './base/FormItem4Title';
import FormItem4ShowNum from './base/FormItem4ShowNum';
import FormItem4LinkMode from './base/FormItem4LinkMode';
import FormGroup4DataSource from './base/FormGroup4DataSource';

// 建模查询中心元素
export default class Content_FormModeCustomSearch extends React.Component {
    constructor(props) {
        super(props);
        this.onChange = this.onChange.bind(this);
    }
    onChange(obj){
        this.props.form.setFieldsValue(obj);
    }
    render() {
        const {eid, ebaseid, eShareLevel, eContent} = this.props.data;
        const {eRollType, eIsShowTitle,eTabs,tabNew} = eContent;
        const {getFieldProps} = this.props.form;
        getFieldProps('eContentIsShowTitle', {initialValue: eIsShowTitle });
        getFieldProps('eContentRollType', {initialValue: eRollType.selected});
        const {formItemLayout} = this.props;
        let eFormItemTABpage = <div></div>;
        let eFormItemPerpage = <div></div>;
        let eFormItemScroll = <div></div>;
        eFormItemPerpage = (
            <FormItem label="标题是否显示" {...formItemLayout}>
                <div className="portal-FormModeCustomSearch-perpage">
                    <WeaCheckbox value={eIsShowTitle} onChange={(value)=>this.onChange({eContentIsShowTitle: value == '1'})}/>
                </div>
            </FormItem>
        );
        eFormItemScroll=(
            <FormItem label="滚动" {...formItemLayout}>
                <div className="portal-FormModeCustomSearch-TABpage" >
                    <WeaSelect options={eRollType.options} style={{width:'80px'}} onChange={(value)=>this.onChange({eContentRollType: value})}/>
                </div>
            </FormItem>
        );
        eFormItemTABpage=(
            <FormItem label="查询列表来源" {...formItemLayout}>
                <Button type="ghost">添加</Button>
            </FormItem>
        );
        const props = {
            eid: eid,
            ebaseid: ebaseid,
            eTabs: eTabs,
            form: this.props.form,
            formItemLayout: formItemLayout
        };
        formGroup4DataSource = <FormGroup4DataSource {...props}/>;
        return (
            <Form horizontal className="esetting-form">
                <FormGroup title="基本信息">
                    <FormItem4Title {...this.props}/>
                    <FormItem4ShowNum {...this.props}/>
                    <FormItem4LinkMode {...this.props}/>
                    {eFormItemPerpage}
                    {eFormItemScroll}
                    {eFormItemTABpage}
                </FormGroup>
                {formGroup4DataSource}
            </Form>
        );
    }
}